<%@ page import="cn.findviewbydream.evil.main.dto.PostListBean" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%--
    工程名：HebeuCS
    时间： 16-11-9
    作者：白雨濃 evil
    邮箱：evilbai@foxmail.com
    内容：贴子列表
    父：code_index.jsp
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--去除多余空格--%>
<%@ page trimDirectiveWhitespaces="true" %>
<%--h5声明--%>
<!DOCTYPE html>
<html>
<head>
    <title>代码讨论区->贴子列表</title>
</head>
<body>

<!--导航-->
<ol class="breadcrumb">
    <li><a href="#">发布区</a></li>
    <li><a href="#">${postListBean.codeType.codeType}</a></li>
    <li class="active">${postListBean.cpn}</li>
</ol>

<!--列表-->
<div id="post-list" class="post-list">
    <c:set var="user" value="${user}"/>

    <c:forEach items="${postListBean.postList}" var="list">
        <div class="post">
            <div class="post-head">
                <img class="img-circle post-head-img"
                     src="/static/image/headimg/${list.post.releaseUser.userImgPath}"
                     alt="头像">
                <div class="post-head-info">
                    <p>用户:${list.post.releaseUser.userRealName}</p>
                    <p>发表于:<fmt:formatDate value="${list.post.overtime}" pattern="yyyy年MM月dd日 HH:mm:ss"/></p>
                </div>
            </div>
            <div class="post-head-content">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <p><a href="#${list.post.postId}">${list.post.title}</a></p>
                    </div>
                </div>
            </div>
            <!--点赞区域-->
            <div style="text-align: right">
                <p style="background-color: rgba(255,255,255,0.1)">
                    <span data-toggle="tooltip"
                          data-placement="right" title="一言不合就点赞?我可不喜欢,点开讨论进去看看吧!">
                        <c:choose>
                            <c:when test="${list.userPraise==true}">
                                <span class="glyphicon glyphicon-heart" style="color:#FF1B50;"></span>
                                <span style="color:#FF1B50;">${list.postPraise.size()}</span>
                            </c:when>
                            <c:otherwise>
                                <span class="glyphicon glyphicon-heart" style="color:gainsboro;"></span>
                                <span style="color:#4c5f72;">${list.postPraise.size()}</span>
                            </c:otherwise>
                        </c:choose>
                    </span>
                </p>
            </div>
        </div>
    </c:forEach>
</div>

<!--分页-->
<div style="text-align: center">
    <ul id="page-list" class="pagination">

    </ul>
</div>
<hr>

</body>
<script>
    $(function ()
    {
        code.init_page(${postListBean.cpn}, ${postListBean.paginalNumber});
        code.select_page(${postListBean.paginalNumber});
    });

    $(function ()
    {
        /*点赞右侧提示*/
        $("[data-toggle='tooltip']").tooltip();
    });
</script>
</html>
